package com.yuedou.jylt.facelib.core.model;

import android.graphics.Rect;

import java.util.List;

public class FaceLandmarkInfo
{
    public List<FaceLandmarkPoint> landmarks;
    public float pitch;
    public float yaw;
    public float roll;
    public float leftEyeClose;
    public float rightEyeClose;
    public float mouseClose;
    public float mouseOpenBig;
    
    public FaceLandmarkInfo() {
        this.pitch = 0.0f;
        this.yaw = 0.0f;
        this.roll = 0.0f;
        this.leftEyeClose = 0.0f;
        this.rightEyeClose = 0.0f;
        this.mouseClose = 0.0f;
        this.mouseOpenBig = 0.0f;
    }
    
    public Rect getBoundingBox() {
        int left = Integer.MAX_VALUE;
        int top = Integer.MAX_VALUE;
        int right = 0;
        int bottom = 0;
        for (final FaceLandmarkPoint p : this.landmarks) {
            if (p.X < left) {
                left = (int)p.X;
            }
            if (p.X > right) {
                right = (int)p.X;
            }
            if (p.Y < top) {
                top = (int)p.Y;
            }
            if (p.Y > bottom) {
                bottom = (int)p.Y;
            }
        }
        return new Rect(left, top, right, bottom);
    }
}
